/**
 * Created by li-rz on 16-12-3.
 */

const NAMESPACE = 'mooc-';
const SPLIT_CHARACTER = '-';

let MoocUtility = {

    /**
     *
     * @param props {Object}
     * @return {String}
     */
    mixinClass(props) {
        let className = '';
        for (let key in props) {
            if (props.hasOwnProperty(key) && props[key]) {
                className += NAMESPACE +
                    key.replace(/([A-Z])/g,
                        function(match, p1) {
                            return SPLIT_CHARACTER + p1.toLowerCase();
                        }) + ' ';
            }
        }
        return className;
    }
};

module.exports = MoocUtility;